package jee.boot.module.bpm.validation;

import jee.boot.common.basic.ServiceException;
import jee.boot.common.basic.result.MapData;
import jee.boot.common.utils.StringUtils;

import javax.validation.constraints.Email;

/**
 * 非空校验
 */
public class EmptyValidation extends BasicValidation implements DataValidation {
    /**
     * 数据校验
     *
     * @param value
     * @param params
     */
    @Override
    @Email
    public void validation(Object value, Object... params) {
        if (value == null || StringUtils.isBlank(value.toString())) {
            throw new ServiceException(1426, MapData.instance().put("param", getParam(0,"",params)).data());
        }

    }
}
